<template>
  <div class="tration"> 
    <el-dialog v-model="show" title="编辑车次.." width="90%" :before-close="() => {}">
      <el-form :model="form" status-icon label-width="120px" class="form">
        <el-form-item label="车长">
          <el-input v-model="form.name" placeholder="车长" /> </el-form-item
        ><el-form-item label="车次">
          <el-input v-model="form.train" placeholder="车次" />
        </el-form-item>
        <el-form-item label="车厢">
          <el-input-number
            v-model="form.con"
            :min="1"
            :max="100" 
          />
        </el-form-item>
        <el-form-item label="类型">
          <el-select
            v-model="form.type"
            class="m-2"
            placeholder="Select"
            size="default"
            @change="
              () => {
                this.$emit('getlist');
              }
            "
          >
            <el-option
              v-for="item in options"
              :key="item"
              :label="item"
              :value="item"
            />
          </el-select>
          <el-form-item label="状态">
            <el-select
              v-model="form.state"
              class="m-2"
              placeholder="Select"
              size="default"
              @change="
                () => {
                  this.$emit('getlist');
                }
              "
            >
              <el-option
                v-for="item in options1"
                :key="item"
                :label="item"
                :value="item"
              />
            </el-select>
          </el-form-item>
        </el-form-item>
        <el-form-item label="日期">
          <el-date-picker
            v-model="form.date"
            type="date"
            placeholder="请输入查询时间"
            value-format="YYYY-MM-DD"
            :default-value="new Date(2022, 8, 27)"
            @change="$emit('getlist')"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="EditSub()">修改</el-button>
          <el-button @click="() => (show = false)"> 取消 </el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      show: false,
      
      options: [
        "高速动车",
        "动车组",
        "城际高速",
        "直达特快",
        "空调特快",
        "快速",
        "普快",
      ],
      options1: ["启用", "停用"],
    };
  },
  props: {
    form: { type: Object },
  },
  watch: {
    show() {
      this.$emit("getshow", !this.show);
    },
  },
  methods: {
    EditSub() {
      this.$emit("EditSub");
      this.show = false;
    },
  },
};
</script>

<style >
.tration {
  transition: 4s;
}
</style>
  init ( ){
      thos.show=!this.show
    }